package com.jie.service;

import com.jie.domain.User;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

/**
 * @author jie
 * @date 2019/8/2 -13:46
 */
@Service
public class UserServcie {

    List<User> users = Arrays.asList(
            new User(1, "jie", "男", 18),
            new User(2, "ryj", "男", 18),
            new User(3, "lzx", "男", 18),
            new User(4, "xhr", "男", 18)
    );

    public User getUsersByUserId(Integer id) {
        for (User user : users) {
            if (user.getId().equals(id)) {
                return user;
            }
        }
        return null;
    }

}
